package cn.xing.model;

import org.springframework.stereotype.Component;

/**
 * 存储当前登录的用户信息
 * @author Xing
 *
 */
@Component
public class HostHolder {
	
	//可能有多个用户
	//每条线程set之后，get的只能是自己之前set的数据
    private static ThreadLocal<User> users = new ThreadLocal<User>();

    public User getUser() {
        return users.get();
    }

    public void setUser(User user) {
        users.set(user);
    }

    public void clear() {
        users.remove();
    }
}
